package it.niedermann.android.markdown.markwon.plugins

import io.noties.markwon.plugin.typogram.parser.QuickParser
import org.junit.Test

class TypogramParser {

    val arrorStr = """
        o-o
    """.trimIndent()

    val sampleTypogramStr="""
        +----+
        |    |---> My first diagram!
        +----+
    """.trimIndent()

    val boxStr="""
        ┌─────────────────────────────────┐       ┌─────────────────────────────────┐
        | ┌─────────────────────────────┐ |       | ┌─────────────────────────────┐ |
        | | "https://rp.example"        | |       | | "https://rp.example"        | |
        | └─────────────────────────────┘ |       | └─────────────────────────────┘ |
        | ┌─────────────────────────────┐ |       | ┌─────────────────────────────┐ |
        | |                             | |       | |                             | |
        | |   Welcome to my website!    | |       | |  Welcome to my website!     | |
        | |                             | |       | |                             | |
        | |                             | |       | |                             | |
        | +─────────────────────────────+ |       | +─────────────────────────────+ |
        | |       Choose an account     | |       | |    Sign-in to rp.example    | |
        | |   to sign-in to rp.example  | |       | |      with idp.example?      | |
        | |                             | |       | |                             | |
        | | ┌────┐                      | |       | | ┌────┐                      | |
        | | | :) |  John Doe            | |  ──►  | | | :) |  John Doe            | |
        | | └────┘  john@email.com      | |       | | └────┘  john@email.com      | |
        | | ┌────┐                      | |       | |                             | |
        | | | :] |  John Doe            | |       | | ┌─────────────────────────┐ | |
        | | └────┘  john.doe@work.com   | |       | | |    Continue as John     | | |
        | |                             | |       | | └─────────────────────────┘ | |
        | └─────────────────────────────┘ |       | └─────────────────────────────┘ |
        └─────────────────────────────────┘       └─────────────────────────────────┘
    """.trimIndent()

    val pipeStr="""
        
     +- -+  -+ +-  |   |   | |   -+-  |    /  \  \     /  +-  -+  +- -+    +   \ /   \   /
     |   |   | |   +- -+  -+ +-   |  -+-  +-  -+  +- -+    \  /  /     \  / \   +     + +
                                                                                     /   \
   
     .- -.  -. .-  |   |   | |   -.-  |    /  \  \     /  .-  -.  .- -.    .   \ /   \   / 
     |   |   | |   '- -'  -' '-   |  -'-  '-  -'  '- -'    \  /  /     \  / \   '     . .  
                                                                                     /   \   
   
      _ _   _   _                ___                       _  _   __ __    _         \   /
     |   |   | |   |_ _|  _| |_   |  _|_  /_  _\  \_  _/   \  /  /     \  / \  \_/   |   |
                                                                                     /   \
   
                                                                                             
     +~ ~+  ~+ +~  :   :   : :   ~+~  : 
     :   :   : :   +~ ~+  ~+ +~   :  ~+~
   
              /    \
      /\  \/  \    /
   
     -.   .-  -. .-. .-  .-.
      '- -'    '-' '-'   '-'
    """.trimIndent()

    val dotStr="""
        o-o   *-o   #-o   |  |  |  \ /    \   /     \ / \   /     \ / \   /
        o-*   *-*   #-*   o  *  #   o  o   o o    *  *   * *    #  #   # #
        o-#   *-#   #-#   |  |  |     / \ /   \  / \    /   \  / \    /   \
    """.trimIndent()

    val arrowStr="""
              |  ^   ^  ^    /  \ 
      ->  <-  v  |  /    \  v    v
    
      ->|  |<- ->o  o<-  ->* *<-  -># #<-           
    
      -   _   *   o   #
      ^   ^   ^   ^   ^     
      |   |   |   |   |     
    
      |   |   |   |   |
      v   v   v   v   v
      -   _   *   o   #   
    
                                      ----
      \ |  | /     ^|  |^   \    /    ^  ^
       v|  |v     / |  | \   v  v    /    \
                         ----    
    """.trimIndent()

    val protocolsStr="""
      +-----+            +-----+
      |  A  |            |  B  |
      +--+--+            +--+--+
         | foo              |
         |----------------->|
         | hello            |
         |----------------->|--+
         |           world  |  | "prompts the user"
         |<-----------------|--+
         |                  |
       --+--              --+--        
    """.trimIndent()

    val architectureStr="""
    Sender                Mail Server              Receiver
                             _____
  .---------.    SMTP       |=====|      POP      .---------.
  |         |-------------->|     |<--------------|         |
  |  Alice  |               |     |               |   Bob   |
  +---------+               |  o  |               +---------+
 /// _____ \\\              |_____|              /// _____ \\\
'-------------'                                 '-------------'
                    +---------------------+
                    |"To: bob@bar.com"    |
                    |"From: alice@foo.com"|
                    |"Body: Hi!"          |
                    +---------------------+        
    """.trimIndent()

    val treeStr="""
            +              +              +-- 1        .-- 1     / 1
           / \             |           +--+         .--+        + 
          /   \        +---+---+       |  +-- 2     |  '-- 2   / \ 2
         +     +       |       |     --+          --+         +  
        / \   / \    +-+-+   +-+-+     |  +-- 3     |  .-- 3   \ / 3
       /   \ /   \   |   |   |   |     +--+         '--+        +  
      1    2 3    4  1   2   3   4        +-- 4        '-- 4     \ 4
      
      
      Linux
       +--Android
       +--Debian
       |   +--Ubuntu
       |   |   +--Lubuntu
       |   |   +--Kubuntu
       |   |   +--Xubuntu
       |   |   `--Xubuntu
       |   `--Mint
       +--Centos
       `--Fedora
      
            
          X            Y
         / \          / \
        A   Y   ->   X   C
           / \      / \
          B   C    A   B
              
    """.trimIndent()

    val gridStr="""
            +----+        +----+                                                                                                         
           /      \      /      \            .-----+-----+-----.                                                                         
          +        +----+        +----+      |     |     |     |          .-----+-----+-----+-----+                                      
           \      /      \      /      \     |     |     |     |         /     /     /     /     /                                       
            +----+        +----+        +    +-----+-----+-----+        +-----+-----+-----+-----+                                        
           /      \      /      \      /     |     |     |     |       /     /     /     /     /
          +        +----+        +----+      |     |     |     |      +-----+-----+-----+-----+
           \      /      \      /      \     +-----+-----+-----+     /     /     /     /     /
            +----+        +----+        +    |     |     |     |    +-----+-----+-----+-----+
                  \      /      \      /     |     |     |     |   /     /     /     /     /
                   +----+        +----+      '-----+-----+-----'  '-----+-----+-----+-----+
    """.trimIndent()


    val mindmaps="""
                                            .-->  Alpha
                                           /
                                          .---->  Initial Release
          Planning *-------.             /         \
                            \           /           '---> Patch 1
      Initial research       \         /             \
                *             \       /               '-->  Patch 2
                 \             \     /---------> Beta
                  \             \   /
                   \             o o                     _______
                    \          .---. *-----.            /       \
                     '------>  |   |       '------o->  . Release .
                               `---' o                  \_______/
                               o  o o \
                              /    \ \ \
                          .--'      \ \ \
                         /           \ \ '----+->  Push backs
                        /             \ \      \
                       /|              \ \      '----> Setbacks
                      / |               \ \
                     V /|                \ '-----> Reception
                Team  / |                 \
                     v /|                  \
             Worklaod / .                   '-->> Career change
                     V /
                 PTO  /
                     V
                 Bug        
    """.trimIndent()

    @Test
    fun testContains() {
        val parser = QuickParser().apply {
            zoom = 1f
            isDebug = false
            defaultTextSize = 30f
        }
        val renderString = parser.render(mindmaps)
        println(renderString)
    }
}